﻿Public Class grades
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub

    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click
        lbl_grade.Text = calcgrade(txt_mark.Text)
    End Sub

    Private Function calcgrade(ByVal markstr As String) As String
        Dim mark As Single
        mark = CSng(markstr)

        Select Case mark
            Case Is >= 70
                Return "A"
            Case Is >= 60
                Return "B"
            Case Is >= 50
                Return "C"
            Case Else
                Return "F"
        End Select

    End Function


End Class